﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace Terra.Data.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Terra_Depts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "部门名称"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父部门ID"),
                    Code = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "部门编码"),
                    FullName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "部门全称"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序号"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "部门状态：1-启用，0-禁用"),
                    LeaderId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "部门负责人ID"),
                    Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "备注"),
                    Path = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "部门层级路径"),
                    Level = table.Column<int>(type: "int", nullable: false, comment: "部门层级"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_Depts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_Depts_Terra_Depts_ParentId",
                        column: x => x.ParentId,
                        principalTable: "Terra_Depts",
                        principalColumn: "Id");
                },
                comment: "部门表");

            migrationBuilder.CreateTable(
                name: "Terra_ExceptionLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ExceptionType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false, comment: "异常类型"),
                    ExceptionMessage = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "异常消息"),
                    StackTrace = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "异常堆栈信息"),
                    Source = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "异常来源"),
                    ExceptionTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "异常发生时间"),
                    TraceId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "请求跟踪ID"),
                    RequestPath = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "发生异常的请求路径"),
                    RequestMethod = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true, comment: "HTTP请求方法"),
                    Severity = table.Column<int>(type: "int", nullable: false, comment: "异常严重程度"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID"),
                    Level = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false, comment: "日志级别：如 Information、Warning、Error 等"),
                    IpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true, comment: "IP地址"),
                    Browser = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "浏览器信息"),
                    OS = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true, comment: "操作系统信息"),
                    Device = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true, comment: "设备信息"),
                    TenantId = table.Column<Guid>(type: "uniqueidentifier", maxLength: 50, nullable: true, comment: "租户ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_ExceptionLogs", x => x.Id);
                },
                comment: "异常日志表");

            migrationBuilder.CreateTable(
                name: "Terra_LoginLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false, comment: "登录用户名"),
                    LoginTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "登录时间"),
                    Status = table.Column<bool>(type: "bit", nullable: false, comment: "登录状态：true成功，false失败"),
                    ErrorMessage = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "登录失败时的错误信息"),
                    LoginMethod = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false, comment: "登录方式：Password密码、OAuth第三方等"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID"),
                    Level = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false, comment: "日志级别：如 Information、Warning、Error 等"),
                    IpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true, comment: "IP地址"),
                    Browser = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "浏览器信息"),
                    OS = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true, comment: "操作系统信息"),
                    Device = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true, comment: "设备信息"),
                    TenantId = table.Column<Guid>(type: "uniqueidentifier", maxLength: 50, nullable: true, comment: "租户ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_LoginLogs", x => x.Id);
                },
                comment: "登录日志表");

            migrationBuilder.CreateTable(
                name: "Terra_Menus",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "菜单名称"),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "父菜单ID"),
                    Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "菜单标题（国际化键）"),
                    Type = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "菜单类型：menu-菜单，catalog-目录，button-按钮，embedded-内嵌，link-外链"),
                    Path = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "路由路径"),
                    ActivePath = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "激活路径，当不在导航菜单中显示时需要指定激活路径"),
                    Component = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "组件路径"),
                    LinkSrc = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "外链或内嵌页面地址"),
                    Icon = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "菜单图标"),
                    ActiveIcon = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "菜单激活图标"),
                    AuthCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "权限标识"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "菜单状态：1-启用，0-禁用"),
                    BadgeType = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "徽章类型：dot-圆点，normal-文本"),
                    Badge = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true, comment: "徽章内容"),
                    BadgeVariants = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "徽章样式"),
                    KeepAlive = table.Column<bool>(type: "bit", nullable: false, comment: "是否缓存标签页"),
                    AffixTab = table.Column<bool>(type: "bit", nullable: false, comment: "是否固定在标签页"),
                    HideInMenu = table.Column<bool>(type: "bit", nullable: false, comment: "在菜单中隐藏"),
                    HideChildrenInMenu = table.Column<bool>(type: "bit", nullable: false, comment: "隐藏子菜单"),
                    HideInBreadcrumb = table.Column<bool>(type: "bit", nullable: false, comment: "在面包屑中隐藏"),
                    HideInTab = table.Column<bool>(type: "bit", nullable: false, comment: "在标签栏中隐藏"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序号"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_Menus", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_Menus_Terra_Menus_ParentId",
                        column: x => x.ParentId,
                        principalTable: "Terra_Menus",
                        principalColumn: "Id");
                },
                comment: "菜单表");

            migrationBuilder.CreateTable(
                name: "Terra_Roles",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "角色名称"),
                    NormalizedName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "规范化角色名称"),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true, comment: "并发标记"),
                    Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "角色描述"),
                    IsSystem = table.Column<bool>(type: "bit", nullable: false, comment: "是否为系统角色"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_Roles", x => x.Id);
                },
                comment: "角色表");

            migrationBuilder.CreateTable(
                name: "Terra_Users",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "用户登录名，唯一"),
                    NormalizedUserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "用户名大写格式，用于不区分大小写查询"),
                    Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "电子邮件地址"),
                    NormalizedEmail = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "电子邮件大写格式，用于不区分大小写查询"),
                    EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, comment: "邮箱是否已验证"),
                    PasswordHash = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true, comment: "密码哈希值，使用PBKDF2加密"),
                    PasswordSalt = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "密码盐值，用于密码重置和令牌验证"),
                    SecurityStamp = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "安全戳，用于密码重置和令牌验证"),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true, comment: "并发标记，用于乐观锁"),
                    PhoneNumber = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true, comment: "手机号码"),
                    PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, comment: "手机号是否已验证"),
                    TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用双因素认证"),
                    LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true, comment: "账号锁定结束时间，null表示未锁定"),
                    LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, comment: "是否启用账号锁定功能"),
                    AccessFailedCount = table.Column<int>(type: "int", nullable: false, comment: "登录失败次数，超过限制将锁定账号"),
                    RequiresPasswordReset = table.Column<bool>(type: "bit", nullable: false, comment: "是否需要重置密码"),
                    LastPasswordChangedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "最后密码修改时间"),
                    RealName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "用户真实姓名"),
                    NickName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "用户昵称，显示名称"),
                    Gender = table.Column<int>(type: "int", nullable: false, comment: "用户性别：0-未知，1-男，2-女"),
                    BirthDate = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "用户出生日期"),
                    AvatarUrl = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "用户头像URL"),
                    Biography = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "用户个人简介"),
                    LastLoginTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "最后登录时间"),
                    LastLoginIp = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true, comment: "最后登录IP地址"),
                    UserType = table.Column<int>(type: "int", nullable: false, comment: "用户类型：0-普通用户，1-管理员，2-系统用户"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "用户状态：0-正常，1-已禁用，2-已锁定，3-未激活"),
                    DeptId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_Users", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_Users_Terra_Depts_DeptId",
                        column: x => x.DeptId,
                        principalTable: "Terra_Depts",
                        principalColumn: "Id");
                },
                comment: "用户信息表");

            migrationBuilder.CreateTable(
                name: "Terra_Permissions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "权限名称"),
                    Code = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "权限编码，唯一标识"),
                    Type = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "权限类型：menu-菜单权限，operation-操作权限，data-数据权限"),
                    MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "关联的菜单ID"),
                    Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "权限描述"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "权限状态：1-启用，0-禁用"),
                    IsSystem = table.Column<bool>(type: "bit", nullable: false, comment: "是否系统权限，系统权限不可删除"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_Permissions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_Permissions_Terra_Menus_MenuId",
                        column: x => x.MenuId,
                        principalTable: "Terra_Menus",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "权限表");

            migrationBuilder.CreateTable(
                name: "Terra_PasswordResetTokens",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "用户ID"),
                    Token = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false, comment: "重置令牌，唯一值"),
                    ResetType = table.Column<int>(type: "int", nullable: false, comment: "重置类型：1-邮件重置，2-短信重置，3-管理员重置"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "创建时间"),
                    ExpiresTime = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "过期时间"),
                    UsedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "使用时间"),
                    IsUsed = table.Column<bool>(type: "bit", nullable: false, comment: "是否已使用：true-已使用，false-未使用")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_PasswordResetTokens", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_PasswordResetTokens_Terra_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Terra_Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "密码重置令牌表");

            migrationBuilder.CreateTable(
                name: "Terra_RefreshTokens",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "用户ID"),
                    Token = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false, comment: "刷新令牌值"),
                    ExpiresAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "过期时间"),
                    IsUsed = table.Column<bool>(type: "bit", nullable: false, comment: "是否已使用"),
                    IsRevoked = table.Column<bool>(type: "bit", nullable: false, comment: "是否已撤销"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "用户代理信息"),
                    IpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true, comment: "IP地址"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "创建者ID"),
                    LastModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "最后修改者ID"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "删除者ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_RefreshTokens", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_RefreshTokens_Terra_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Terra_Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "刷新令牌表");

            migrationBuilder.CreateTable(
                name: "Terra_UserClaims",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ClaimType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    ClaimValue = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_UserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_UserClaims_Terra_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Terra_Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Terra_UserRoles",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "用户ID"),
                    RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "角色ID"),
                    RoleId1 = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_UserRoles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_UserRoles_Terra_Roles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "Terra_Roles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Terra_UserRoles_Terra_Roles_RoleId1",
                        column: x => x.RoleId1,
                        principalTable: "Terra_Roles",
                        principalColumn: "Id");
                    table.ForeignKey(
                        name: "FK_Terra_UserRoles_Terra_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Terra_Users",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "用户角色关系表");

            migrationBuilder.CreateTable(
                name: "Terra_RolePermissions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "角色ID"),
                    PermissionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "权限ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Terra_RolePermissions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Terra_RolePermissions_Terra_Permissions_PermissionId",
                        column: x => x.PermissionId,
                        principalTable: "Terra_Permissions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Terra_RolePermissions_Terra_Roles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "Terra_Roles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "角色权限关联表");

            migrationBuilder.InsertData(
                table: "Terra_Depts",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "FullName", "IsDeleted", "LastModifiedBy", "LastModifiedTime", "LeaderId", "Level", "Name", "ParentId", "Path", "Remark", "Sort", "Status" },
                values: new object[] { new Guid("a0da03d1-d316-4c15-ad3f-f3d8aeb2472f"), "HQ", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "Terra科技有限公司", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 1, "总公司", null, "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/", "公司总部", 10, 1 });

            migrationBuilder.InsertData(
                table: "Terra_Menus",
                columns: new[] { "Id", "ActiveIcon", "ActivePath", "AffixTab", "AuthCode", "Badge", "BadgeType", "BadgeVariants", "Component", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "HideChildrenInMenu", "HideInBreadcrumb", "HideInMenu", "HideInTab", "Icon", "IsDeleted", "KeepAlive", "LastModifiedBy", "LastModifiedTime", "LinkSrc", "Name", "ParentId", "Path", "Sort", "Status", "Title", "Type" },
                values: new object[,]
                {
                    { new Guid("a94a1520-a6a2-4180-9fac-9a901ad40ae0"), null, null, false, "menu:dashboard", null, null, null, "LAYOUT", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:dashboard", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "Dashboard", null, "/dashboard", 10, 1, "page.dashboard.title", "catalog" },
                    { new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), null, null, false, "menu:system", "new", "normal", "primary", "LAYOUT", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:settings", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "System", null, "/system", 90, 1, "system.title", "catalog" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Roles",
                columns: new[] { "Id", "ConcurrencyStamp", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "Description", "IsDeleted", "IsSystem", "LastModifiedBy", "LastModifiedTime", "Name", "NormalizedName" },
                values: new object[,]
                {
                    { new Guid("a8d7d9bd-20f0-4aad-a772-9f27bae526e1"), "1c60bea0-a288-4a10-9de9-29864686709a", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), null, null, "系统超级管理员，拥有所有权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), "超级管理员", "超级管理员" },
                    { new Guid("b9a3493d-7513-4d89-a149-28e5d0d02654"), "840c36ac-4a53-4233-9284-2e01a79635ef", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), null, null, "系统普通用户，拥有基本权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), "普通用户", "普通用户" },
                    { new Guid("c1ea59c0-4e36-4f31-9d4e-f5a35ddb5e82"), "1cefbf69-1322-4732-8be1-498c3f6ecb80", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), null, null, "系统访客，拥有只读权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(3534), "访客", "访客" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Users",
                columns: new[] { "Id", "AccessFailedCount", "AvatarUrl", "Biography", "BirthDate", "ConcurrencyStamp", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "DeptId", "Email", "EmailConfirmed", "Gender", "IsDeleted", "LastLoginIp", "LastLoginTime", "LastModifiedBy", "LastModifiedTime", "LastPasswordChangedTime", "LockoutEnabled", "LockoutEnd", "NickName", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PasswordSalt", "PhoneNumber", "PhoneNumberConfirmed", "RealName", "RequiresPasswordReset", "SecurityStamp", "Status", "TwoFactorEnabled", "UserName", "UserType" },
                values: new object[] { new Guid("308a6931-2e89-4432-b71c-478f6414a127"), 0, null, null, null, "badc2173-ddd5-4dd5-8ea1-1615e7bb4ff6", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 527, DateTimeKind.Utc).AddTicks(6590), null, null, null, "admin@terra.com", true, 0, false, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 527, DateTimeKind.Utc).AddTicks(6590), null, true, null, null, "ADMIN@TERRA.COM", "ADMIN", "yNbzWTuFj4Qb0fOADSQKQXVdCu2n6TAHBS7+QqYTCg4=", "z4uBUSK+2nVRtAdNvjjpcA==", null, false, null, false, "8588b946-ed9f-41bd-a45c-5162b3a23734", 0, false, "admin", 0 });

            migrationBuilder.InsertData(
                table: "Terra_Depts",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "FullName", "IsDeleted", "LastModifiedBy", "LastModifiedTime", "LeaderId", "Level", "Name", "ParentId", "Path", "Remark", "Sort", "Status" },
                values: new object[,]
                {
                    { new Guid("b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9"), "TC", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "技术研发中心", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 2, "技术中心", new Guid("a0da03d1-d316-4c15-ad3f-f3d8aeb2472f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/", "负责产品研发和技术支持", 20, 1 },
                    { new Guid("c33894ee-a40a-4d42-8130-8f7305d2a10d"), "MC", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "市场营销中心", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 2, "营销中心", new Guid("a0da03d1-d316-4c15-ad3f-f3d8aeb2472f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/c33894ee-a40a-4d42-8130-8f7305d2a10d/", "负责市场营销和客户拓展", 30, 1 },
                    { new Guid("d6f09def-bc69-4472-801d-7f6684f65bd0"), "HR", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "人力资源管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 2, "人力资源部", new Guid("a0da03d1-d316-4c15-ad3f-f3d8aeb2472f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/d6f09def-bc69-4472-801d-7f6684f65bd0/", "负责人才招聘和培训发展", 40, 1 },
                    { new Guid("e5b24114-dbe6-4eb2-9d3d-b4143929bb9f"), "FD", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "财务管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 2, "财务部", new Guid("a0da03d1-d316-4c15-ad3f-f3d8aeb2472f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/e5b24114-dbe6-4eb2-9d3d-b4143929bb9f/", "负责财务管理和成本控制", 50, 1 }
                });

            migrationBuilder.InsertData(
                table: "Terra_Menus",
                columns: new[] { "Id", "ActiveIcon", "ActivePath", "AffixTab", "AuthCode", "Badge", "BadgeType", "BadgeVariants", "Component", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "HideChildrenInMenu", "HideInBreadcrumb", "HideInMenu", "HideInTab", "Icon", "IsDeleted", "KeepAlive", "LastModifiedBy", "LastModifiedTime", "LinkSrc", "Name", "ParentId", "Path", "Sort", "Status", "Title", "Type" },
                values: new object[,]
                {
                    { new Guid("a72a9dd9-8732-40c5-bce1-9ea544ff3b04"), null, null, false, "menu:system:role", null, null, null, "/system/role/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:user-role", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "SystemRole", new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "/system/role", 93, 1, "system.role.title", "menu" },
                    { new Guid("b2781e73-e654-4128-9766-46e58eaf1062"), null, null, true, "menu:dashboard:analytics", null, null, null, "/dashboard/analytics/index", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:analytics", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "Analytics", new Guid("a94a1520-a6a2-4180-9fac-9a901ad40ae0"), "/dashboard/analytics", 11, 1, "page.dashboard.analytics", "menu" },
                    { new Guid("b83bddb0-9943-41ae-b62a-e8fe3bcbc832"), null, null, false, "menu:system:dept", null, null, null, "/system/dept/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:organization", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "SystemDept", new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "/system/dept", 94, 1, "system.dept.title", "menu" },
                    { new Guid("c3bafbce-7836-4c31-91b2-84dbd0a0f161"), null, null, false, "menu:dashboard:workspace", null, null, null, "/dashboard/workspace/index", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:workspace", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "Workspace", new Guid("a94a1520-a6a2-4180-9fac-9a901ad40ae0"), "/dashboard/workspace", 12, 1, "page.dashboard.workspace", "menu" },
                    { new Guid("c94d352d-9654-428b-940d-d7fe35160adf"), null, null, false, "menu:log", null, null, null, "LAYOUT", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:document", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "Log", new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "/log", 95, 1, "log.title", "catalog" },
                    { new Guid("e503b8f5-9fa6-4b4d-9aeb-ea1c1fb0c8e2"), null, null, false, "menu:system:menu", null, null, null, "/system/menu/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:menu", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "SystemMenu", new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "/system/menu", 91, 1, "system.menu.title", "menu" },
                    { new Guid("f69a0eb6-b6c7-40b7-a0ca-0bdf68d4f448"), null, null, false, "menu:system:user", null, null, null, "/system/user/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:user", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "SystemUser", new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "/system/user", 92, 1, "system.user.title", "menu" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Permissions",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "Description", "IsDeleted", "IsSystem", "LastModifiedBy", "LastModifiedTime", "MenuId", "Name", "Status", "Type" },
                values: new object[,]
                {
                    { new Guid("db9e3715-92f1-4bad-a1b6-b95aaea13059"), "dashboard", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "仪表盘目录访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("a94a1520-a6a2-4180-9fac-9a901ad40ae0"), "仪表盘目录", 1, "menu" },
                    { new Guid("e6de4024-3dd3-41b4-bd4d-db1c5936b54d"), "system", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "系统管理目录访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("d456b674-9e55-4ba4-bff1-f7e6a4825146"), "系统管理", 1, "menu" }
                });

            migrationBuilder.InsertData(
                table: "Terra_UserRoles",
                columns: new[] { "Id", "RoleId", "RoleId1", "UserId" },
                values: new object[] { new Guid("bdffa985-b294-4eca-a100-feea65eca1f2"), new Guid("a8d7d9bd-20f0-4aad-a772-9f27bae526e1"), null, new Guid("308a6931-2e89-4432-b71c-478f6414a127") });

            migrationBuilder.InsertData(
                table: "Terra_Depts",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "FullName", "IsDeleted", "LastModifiedBy", "LastModifiedTime", "LeaderId", "Level", "Name", "ParentId", "Path", "Remark", "Sort", "Status" },
                values: new object[,]
                {
                    { new Guid("a5f6d150-d0dd-43c6-abdf-bf3d321d40f9"), "REC", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "人才招聘部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "招聘部", new Guid("d6f09def-bc69-4472-801d-7f6684f65bd0"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/d6f09def-bc69-4472-801d-7f6684f65bd0/a5f6d150-d0dd-43c6-abdf-bf3d321d40f9/", "负责人才招聘", 41, 1 },
                    { new Guid("a7f6d15f-504c-41c6-abae-b83d325140f8"), "QA", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "质量保障部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "测试部", new Guid("b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/a7f6d15f-504c-41c6-abae-b83d325140f8/", "负责质量保障", 22, 1 },
                    { new Guid("b06b4c1d-339b-4d20-bea8-37c13fdf98f3"), "OPS", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "运维管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "运维部", new Guid("b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/b06b4c1d-339b-4d20-bea8-37c13fdf98f3/", "负责系统运维", 23, 1 },
                    { new Guid("b6b6c12d-3a9c-4d21-bfa9-c7c23fd988f4"), "TRN", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "员工培训发展部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "培训部", new Guid("d6f09def-bc69-4472-801d-7f6684f65bd0"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/d6f09def-bc69-4472-801d-7f6684f65bd0/b6b6c12d-3a9c-4d21-bfa9-c7c23fd988f4/", "负责员工培训与发展", 42, 1 },
                    { new Guid("c1a6e125-dd60-4604-9e7e-7df25c0cb5cc"), "PM", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "产品管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "产品部", new Guid("b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/c1a6e125-dd60-4604-9e7e-7df25c0cb5cc/", "负责产品设计与规划", 24, 1 },
                    { new Guid("c74462e0-fc48-4f9f-b0e9-2c90b1d58323"), "ADM", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "行政管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "行政部", new Guid("d6f09def-bc69-4472-801d-7f6684f65bd0"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/d6f09def-bc69-4472-801d-7f6684f65bd0/c74462e0-fc48-4f9f-b0e9-2c90b1d58323/", "负责日常行政事务", 43, 1 },
                    { new Guid("d80e8265-b970-4789-beb1-da1c4b4ece83"), "SALES", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "销售部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "销售部", new Guid("c33894ee-a40a-4d42-8130-8f7305d2a10d"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/c33894ee-a40a-4d42-8130-8f7305d2a10d/d80e8265-b970-4789-beb1-da1c4b4ece83/", "负责产品销售", 31, 1 },
                    { new Guid("d9e7a3b5-e011-4a1f-8c94-c30a02493113"), "ACC", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "会计核算部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "会计部", new Guid("e5b24114-dbe6-4eb2-9d3d-b4143929bb9f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/e5b24114-dbe6-4eb2-9d3d-b4143929bb9f/d9e7a3b5-e011-4a1f-8c94-c30a02493113/", "负责财务核算", 51, 1 },
                    { new Guid("e0e29c44-5890-417b-9cab-d41eaee03dcb"), "TRE", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "资金管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "资金部", new Guid("e5b24114-dbe6-4eb2-9d3d-b4143929bb9f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/e5b24114-dbe6-4eb2-9d3d-b4143929bb9f/e0e29c44-5890-417b-9cab-d41eaee03dcb/", "负责资金调配和管理", 52, 1 },
                    { new Guid("e68fc23a-3f87-46ac-9bfe-c1f7a2f6c073"), "MKT", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "市场推广部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "市场部", new Guid("c33894ee-a40a-4d42-8130-8f7305d2a10d"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/c33894ee-a40a-4d42-8130-8f7305d2a10d/e68fc23a-3f87-46ac-9bfe-c1f7a2f6c073/", "负责市场推广", 32, 1 },
                    { new Guid("f0ddb3b0-c15d-4c65-b0a9-5617a08f86a2"), "CS", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "客户服务部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "客服部", new Guid("c33894ee-a40a-4d42-8130-8f7305d2a10d"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/c33894ee-a40a-4d42-8130-8f7305d2a10d/f0ddb3b0-c15d-4c65-b0a9-5617a08f86a2/", "负责客户服务与支持", 33, 1 },
                    { new Guid("f1dfd512-f2c2-487f-a1ca-e5ec6cbfdece"), "TAX", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "税务管理部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "税务部", new Guid("e5b24114-dbe6-4eb2-9d3d-b4143929bb9f"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/e5b24114-dbe6-4eb2-9d3d-b4143929bb9f/f1dfd512-f2c2-487f-a1ca-e5ec6cbfdece/", "负责税务规划与管理", 53, 1 },
                    { new Guid("f27876b2-d2ee-4782-8421-87ccd90e1b7c"), "DEV", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "研发部", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 3, "研发部", new Guid("b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/f27876b2-d2ee-4782-8421-87ccd90e1b7c/", "负责产品开发", 21, 1 }
                });

            migrationBuilder.InsertData(
                table: "Terra_Menus",
                columns: new[] { "Id", "ActiveIcon", "ActivePath", "AffixTab", "AuthCode", "Badge", "BadgeType", "BadgeVariants", "Component", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "HideChildrenInMenu", "HideInBreadcrumb", "HideInMenu", "HideInTab", "Icon", "IsDeleted", "KeepAlive", "LastModifiedBy", "LastModifiedTime", "LinkSrc", "Name", "ParentId", "Path", "Sort", "Status", "Title", "Type" },
                values: new object[,]
                {
                    { new Guid("d05e14e5-8065-4d8b-9d3c-89e88ebf2b9c"), null, null, false, "menu:log:login", null, null, null, "/log/login/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:login", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "LoginLog", new Guid("c94d352d-9654-428b-940d-d7fe35160adf"), "/log/login", 96, 1, "log.login.title", "menu" },
                    { new Guid("e16b7176-9d76-4a5d-8c6d-fa1e1e37c92d"), null, null, false, "menu:log:operation", null, null, null, "/log/operation/list", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:data-view-alt", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "OperationLog", new Guid("c94d352d-9654-428b-940d-d7fe35160adf"), "/log/operation", 97, 1, "log.operation.title", "menu" },
                    { new Guid("f1b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:menu:create", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:add", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "MenuCreate", new Guid("e503b8f5-9fa6-4b4d-9aeb-ea1c1fb0c8e2"), null, 1, 1, "system.menu.create", "button" },
                    { new Guid("f2b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:menu:update", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:edit", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "MenuUpdate", new Guid("e503b8f5-9fa6-4b4d-9aeb-ea1c1fb0c8e2"), null, 2, 1, "system.menu.update", "button" },
                    { new Guid("f3b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:menu:delete", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:delete", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "MenuDelete", new Guid("e503b8f5-9fa6-4b4d-9aeb-ea1c1fb0c8e2"), null, 3, 1, "system.menu.delete", "button" },
                    { new Guid("f4b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:user:create", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:add", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "UserCreate", new Guid("f69a0eb6-b6c7-40b7-a0ca-0bdf68d4f448"), null, 1, 1, "system.user.create", "button" },
                    { new Guid("f5b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:user:update", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:edit", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "UserUpdate", new Guid("f69a0eb6-b6c7-40b7-a0ca-0bdf68d4f448"), null, 2, 1, "system.user.update", "button" },
                    { new Guid("f6b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:user:delete", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:delete", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "UserDelete", new Guid("f69a0eb6-b6c7-40b7-a0ca-0bdf68d4f448"), null, 3, 1, "system.user.delete", "button" },
                    { new Guid("f7b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:role:create", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:add", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "RoleCreate", new Guid("a72a9dd9-8732-40c5-bce1-9ea544ff3b04"), null, 1, 1, "system.role.create", "button" },
                    { new Guid("f8b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:role:update", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:edit", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "RoleUpdate", new Guid("a72a9dd9-8732-40c5-bce1-9ea544ff3b04"), null, 2, 1, "system.role.update", "button" },
                    { new Guid("f9b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:role:delete", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:delete", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "RoleDelete", new Guid("a72a9dd9-8732-40c5-bce1-9ea544ff3b04"), null, 3, 1, "system.role.delete", "button" },
                    { new Guid("fab7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:dept:create", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:add", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "DeptCreate", new Guid("b83bddb0-9943-41ae-b62a-e8fe3bcbc832"), null, 1, 1, "system.dept.create", "button" },
                    { new Guid("fbb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:dept:update", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:edit", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "DeptUpdate", new Guid("b83bddb0-9943-41ae-b62a-e8fe3bcbc832"), null, 2, 1, "system.dept.update", "button" },
                    { new Guid("fcb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:system:dept:delete", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:delete", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "DeptDelete", new Guid("b83bddb0-9943-41ae-b62a-e8fe3bcbc832"), null, 3, 1, "system.dept.delete", "button" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Permissions",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "Description", "IsDeleted", "IsSystem", "LastModifiedBy", "LastModifiedTime", "MenuId", "Name", "Status", "Type" },
                values: new object[,]
                {
                    { new Guid("48e14caf-2ecd-4c3d-ae37-32e60a313f37"), "system:role", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "角色管理页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("a72a9dd9-8732-40c5-bce1-9ea544ff3b04"), "角色管理", 1, "menu" },
                    { new Guid("492a8661-9d2c-46ba-b3f5-e0e9f1f93649"), "log", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "日志管理目录访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("c94d352d-9654-428b-940d-d7fe35160adf"), "日志管理", 1, "menu" },
                    { new Guid("62b0572d-11c1-43eb-8b64-b414eb98e343"), "system:menu", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "菜单管理页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("e503b8f5-9fa6-4b4d-9aeb-ea1c1fb0c8e2"), "菜单管理", 1, "menu" },
                    { new Guid("66a821ff-a697-4cda-a56f-9b44bb684d2d"), "system:user", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "用户管理页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f69a0eb6-b6c7-40b7-a0ca-0bdf68d4f448"), "用户管理", 1, "menu" },
                    { new Guid("c0a8c9bd-5dbc-4022-a8c9-76e8643818e2"), "system:dept", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "部门管理页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("b83bddb0-9943-41ae-b62a-e8fe3bcbc832"), "部门管理", 1, "menu" },
                    { new Guid("c1de3645-422e-497a-ab8e-31cdba8d4b30"), "dashboard:workspace", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "工作台页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("c3bafbce-7836-4c31-91b2-84dbd0a0f161"), "工作台", 1, "menu" },
                    { new Guid("eab6a90d-4f36-40a1-abe9-101a62c31ea5"), "dashboard:analytics", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "数据分析页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("b2781e73-e654-4128-9766-46e58eaf1062"), "数据分析", 1, "menu" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Depts",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "FullName", "IsDeleted", "LastModifiedBy", "LastModifiedTime", "LeaderId", "Level", "Name", "ParentId", "Path", "Remark", "Sort", "Status" },
                values: new object[,]
                {
                    { new Guid("a2c47a13-317b-4e16-b629-25de7ac0899b"), "FE", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "前端开发组", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 4, "前端组", new Guid("f27876b2-d2ee-4782-8421-87ccd90e1b7c"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/f27876b2-d2ee-4782-8421-87ccd90e1b7c/a2c47a13-317b-4e16-b629-25de7ac0899b/", "负责前端开发", 211, 1 },
                    { new Guid("b3c58db7-42b9-42d8-a70a-3c07fa2f3aed"), "BE", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, null, "后端开发组", false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 529, DateTimeKind.Utc).AddTicks(4127), null, 4, "后端组", new Guid("f27876b2-d2ee-4782-8421-87ccd90e1b7c"), "/a0da03d1-d316-4c15-ad3f-f3d8aeb2472f/b1cfacb2-f0ee-4a6e-b6c6-45c91d35ace9/f27876b2-d2ee-4782-8421-87ccd90e1b7c/b3c58db7-42b9-42d8-a70a-3c07fa2f3aed/", "负责后端开发", 212, 1 }
                });

            migrationBuilder.InsertData(
                table: "Terra_Menus",
                columns: new[] { "Id", "ActiveIcon", "ActivePath", "AffixTab", "AuthCode", "Badge", "BadgeType", "BadgeVariants", "Component", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "HideChildrenInMenu", "HideInBreadcrumb", "HideInMenu", "HideInTab", "Icon", "IsDeleted", "KeepAlive", "LastModifiedBy", "LastModifiedTime", "LinkSrc", "Name", "ParentId", "Path", "Sort", "Status", "Title", "Type" },
                values: new object[,]
                {
                    { new Guid("fdb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:log:login:clean", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:clean", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "LoginLogClean", new Guid("d05e14e5-8065-4d8b-9d3c-89e88ebf2b9c"), null, 1, 1, "log.login.clean", "button" },
                    { new Guid("feb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), null, null, false, "menu:log:operation:clean", null, null, null, null, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, null, false, false, false, false, "carbon:clean", false, false, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(7858), null, "OperationLogClean", new Guid("e16b7176-9d76-4a5d-8c6d-fa1e1e37c92d"), null, 1, 1, "log.operation.clean", "button" }
                });

            migrationBuilder.InsertData(
                table: "Terra_Permissions",
                columns: new[] { "Id", "Code", "CreatedBy", "CreatedTime", "DeletedBy", "DeletedTime", "Description", "IsDeleted", "IsSystem", "LastModifiedBy", "LastModifiedTime", "MenuId", "Name", "Status", "Type" },
                values: new object[,]
                {
                    { new Guid("09e2cd4d-d4d4-4977-b2f6-b5e7a50d64bb"), "log:operation", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "操作日志页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("e16b7176-9d76-4a5d-8c6d-fa1e1e37c92d"), "操作日志", 1, "menu" },
                    { new Guid("1e778005-c2ab-42dd-ab9d-8143822fa862"), "system:dept:create", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "创建部门的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("fab7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "部门创建", 1, "operation" },
                    { new Guid("2d4292aa-6d33-4351-ae01-e48cc58d5c31"), "system:role:create", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "创建角色的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f7b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "角色创建", 1, "operation" },
                    { new Guid("3c8b95bc-57bc-4cb0-a017-bcf346f0d784"), "system:menu:delete", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "删除菜单的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f3b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "菜单删除", 1, "operation" },
                    { new Guid("49fb9fc4-12f6-4130-be3a-4d61d124f978"), "system:menu:create", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "创建菜单的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f1b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "菜单创建", 1, "operation" },
                    { new Guid("50af864c-1356-43a9-9816-34a77a2c51d1"), "system:role:update", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "修改角色的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f8b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "角色修改", 1, "operation" },
                    { new Guid("54ec62a8-45c1-4161-927b-51d167a7484e"), "system:user:delete", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "删除用户的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f6b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "用户删除", 1, "operation" },
                    { new Guid("578e6dc9-5623-4ac3-8212-b8e16aa46acb"), "system:user:update", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "修改用户的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f5b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "用户修改", 1, "operation" },
                    { new Guid("5dcf78e5-3173-44af-8f94-012047ed5fe5"), "system:menu:update", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "修改菜单的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f2b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "菜单修改", 1, "operation" },
                    { new Guid("6d787946-01f8-40cd-abb1-25802af22328"), "system:dept:delete", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "删除部门的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("fcb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "部门删除", 1, "operation" },
                    { new Guid("7b9ed8b4-de74-4fd4-af08-e813e0898d75"), "system:role:delete", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "删除角色的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f9b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "角色删除", 1, "operation" },
                    { new Guid("c4840099-7207-4215-ac74-fd9dbb6aeb19"), "system:dept:update", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "修改部门的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("fbb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "部门修改", 1, "operation" },
                    { new Guid("c701cdfa-e430-400a-a8cc-10dbfe4271ee"), "log:login", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "登录日志页面访问权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("d05e14e5-8065-4d8b-9d3c-89e88ebf2b9c"), "登录日志", 1, "menu" },
                    { new Guid("dd62fc7e-503e-4fa4-bf4c-ca2498fdf322"), "system:user:create", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "创建用户的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("f4b7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "用户创建", 1, "operation" },
                    { new Guid("9ddf9ba9-42f0-4ddc-acee-91aad656ab74"), "log:login:clean", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "清理登录日志的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("fdb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "登录日志清理", 1, "operation" },
                    { new Guid("e9f28485-67c0-4c10-a914-0a5252f62b53"), "log:operation:clean", new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), null, null, "清理操作日志的权限", false, true, new Guid("308a6931-2e89-4432-b71c-478f6414a127"), new DateTime(2025, 5, 5, 3, 0, 27, 218, DateTimeKind.Utc).AddTicks(8747), new Guid("feb7d9b0-8c1a-4b5a-b91e-9c1e1e37c92d"), "操作日志清理", 1, "operation" }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Dept_Name",
                table: "Terra_Depts",
                column: "Name",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Dept_ParentId",
                table: "Terra_Depts",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_Dept_Sort",
                table: "Terra_Depts",
                column: "Sort");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_ExceptionLogs_ExceptionTime",
                table: "Terra_ExceptionLogs",
                column: "ExceptionTime");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_ExceptionLogs_Severity",
                table: "Terra_ExceptionLogs",
                column: "Severity");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_ExceptionLogs_TraceId",
                table: "Terra_ExceptionLogs",
                column: "TraceId");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_LoginLogs_LoginTime",
                table: "Terra_LoginLogs",
                column: "LoginTime");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_LoginLogs_UserName",
                table: "Terra_LoginLogs",
                column: "UserName");

            migrationBuilder.CreateIndex(
                name: "IX_Menu_AuthCode",
                table: "Terra_Menus",
                column: "AuthCode");

            migrationBuilder.CreateIndex(
                name: "IX_Menu_Name",
                table: "Terra_Menus",
                column: "Name",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Menu_ParentId",
                table: "Terra_Menus",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_PasswordResetTokens_CreatedTime",
                table: "Terra_PasswordResetTokens",
                column: "CreatedTime");

            migrationBuilder.CreateIndex(
                name: "IX_PasswordResetTokens_Token",
                table: "Terra_PasswordResetTokens",
                column: "Token",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_PasswordResetTokens_UserId",
                table: "Terra_PasswordResetTokens",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Permission_Code",
                table: "Terra_Permissions",
                column: "Code");

            migrationBuilder.CreateIndex(
                name: "IX_Permission_Code1",
                table: "Terra_Permissions",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Permission_MenuId",
                table: "Terra_Permissions",
                column: "MenuId",
                unique: true,
                filter: "[MenuId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_Permission_Type",
                table: "Terra_Permissions",
                column: "Type");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_RefreshTokens_Token",
                table: "Terra_RefreshTokens",
                column: "Token",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Terra_RefreshTokens_UserId",
                table: "Terra_RefreshTokens",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_RolePermission_RolePermission",
                table: "Terra_RolePermissions",
                columns: new[] { "RoleId", "PermissionId" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Terra_RolePermissions_PermissionId",
                table: "Terra_RolePermissions",
                column: "PermissionId");

            migrationBuilder.CreateIndex(
                name: "IX_Roles_Name",
                table: "Terra_Roles",
                column: "Name",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Terra_UserClaims_UserId",
                table: "Terra_UserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_UserRoles_RoleId",
                table: "Terra_UserRoles",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_UserRoles_RoleId1",
                table: "Terra_UserRoles",
                column: "RoleId1");

            migrationBuilder.CreateIndex(
                name: "IX_UserRoles_UserRole",
                table: "Terra_UserRoles",
                columns: new[] { "UserId", "RoleId" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Terra_Users_DeptId",
                table: "Terra_Users",
                column: "DeptId");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_Users_NormalizedEmail",
                table: "Terra_Users",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "IX_Terra_Users_NormalizedUserName",
                table: "Terra_Users",
                column: "NormalizedUserName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Terra_Users_PhoneNumber",
                table: "Terra_Users",
                column: "PhoneNumber");

            migrationBuilder.CreateIndex(
                name: "IX_Users_Email",
                table: "Terra_Users",
                column: "Email",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Users_UserName",
                table: "Terra_Users",
                column: "UserName",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Terra_ExceptionLogs");

            migrationBuilder.DropTable(
                name: "Terra_LoginLogs");

            migrationBuilder.DropTable(
                name: "Terra_PasswordResetTokens");

            migrationBuilder.DropTable(
                name: "Terra_RefreshTokens");

            migrationBuilder.DropTable(
                name: "Terra_RolePermissions");

            migrationBuilder.DropTable(
                name: "Terra_UserClaims");

            migrationBuilder.DropTable(
                name: "Terra_UserRoles");

            migrationBuilder.DropTable(
                name: "Terra_Permissions");

            migrationBuilder.DropTable(
                name: "Terra_Roles");

            migrationBuilder.DropTable(
                name: "Terra_Users");

            migrationBuilder.DropTable(
                name: "Terra_Menus");

            migrationBuilder.DropTable(
                name: "Terra_Depts");
        }
    }
}
